<div class="col-md-12">
    <div class="panel panel-primary">
        <header class="panel-heading">
            <div class="row">
                <div class="col-md-8">
                    <a type="button" class="btn btn-info btn-xs" ng-click="showClusters('showAll')">全部集群</a>
                    <a type="button" class="btn btn-info btn-xs" ng-click="showClusters('showUnhealthy')">问题集群</a>
                    <a type="button" class="btn btn-info btn-xs" ng-click="showClusters('showErrorMigrating')">迁移异常集群</a>
                    <a type="button" class="btn btn-info btn-xs" ng-click="showClusters('showMigrating')">迁移中集群</a>
                    <div>
                        <a class="btn btn-round btn-xs" ng-click="selectDisplayed()">当前页全选</a>
                        <a class="btn btn-round btn-xs" ng-click="selectFiltered()">跨页全选</a>
                        <a class="btn btn-round btn-xs" ng-click="selectAll()">无视筛选条件全选</a>
                        <a class="btn btn-round btn-xs" ng-click="unselectAll()">取消所有选中</a>
                    </div>
                </div>
                <div class="col-md-4 text-right" ng-if="showAll">
                    <a ng-if="showAll" type="button" class="btn btn-info btn-xs" href="/#/cluster_form?clusterName=&type=create">创建Cluster</a>
                    <a class="btn btn-info btn-xs" ng-click="showClusterDetails()">详细信息</a>
                    <a class="btn btn-danger btn-xs" ng-click="migrateSelectedClusters()">迁移</a>
                </div>
                <div class="col-md-4 text-right" ng-if="showUnhealthy">
                    <a class="btn btn-danger btn-xs" ng-click="migrateSelectedClusters()">迁移</a>
                </div>
                <div class="col-md-4 text-right" ng-if="showErrorMigrating">
                    <a class="btn btn-danger btn-xs" ng-click="preResetSelectedClusterStatus()">重置状态</a>
                    <a class="btn btn-danger btn-xs" ng-click="migrateSelectedClusters()">迁移</a>
                </div>
                <div class="col-md-4 text-right" ng-if="showMigrating">
                    <a class="btn btn-danger btn-xs" ng-click="preResetSelectedClusterStatus()">重置状态</a>
                    <a class="btn btn-danger btn-xs" ng-click="preContinueSelectedCluster()">批量继续</a>
                    <a class="btn btn-danger btn-xs" ng-click="preForceSelectedCluster()">批量强制继续</a>
                </div>
            </div>
        </header>

        <table ng-table="tableParams" show-filter="true" class="table table-striped table-hover" ng-table-columns-binding="cols">
            <tr ng-repeat-start="cluster in $data">
                <td>
                    <input type="checkbox" ng-checked="cluster.isChecked" ng-model="cluster.isChecked">
                </td>
                <td data-title="'cluster'" filter="{ clusterName : 'text' }">
                    <a href="/#/cluster_dc_shards/{{cluster.clusterName}}/">{{ cluster.clusterName }}</a>
                </td>
                <td data-title="'ID'" filter="{ id : 'text' }">
                    <a ng-if="true"   ng-bind="cluster.id" ng-click="gotoClusterHickwall(cluster.clusterType ,cluster.clusterName)" style="width:70px" ></a>
                </td>
                <td ng-if="showUnhealthy" data-title="'详情'"><div class="action-buttons">
                    <a href="javascript:void(0)" class="green bigger-140 show-details-btn"
                       title="Show Details" ng-click="cluster.showDetail = !cluster.showDetail">
                        <i ng-show="!cluster.showDetail" class="ace-icon fa fa-angle-double-down blue"></i>
                        <i ng-show="cluster.showDetail" class="ace-icon fa fa-angle-double-up blue"></i>
                    </a>
                </div></td>
                <td ng-if="showUnhealthy" data-title="'问题分片数'" ng-bind="cluster.unhealthyShardsCnt" sortable="'unhealthyShardsCnt'" ></td>
                <td ng-if="showUnhealthy" data-title="'问题实例数'" ng-bind="cluster.unhealthyRedisCnt" sortable="'unhealthyRedisCnt'" ></td>
                <td ng-if="showErrorMigrating || showMigrating" data-title="'ClusterStatus'" ng-bind="cluster.status"></td>
                <td ng-if="showErrorMigrating || showMigrating" data-title="'MigrationStatus'" ng-bind="cluster.migrationClusters.status"></td>
                <td ng-if="true" data-title="'主数据中心'" filter="{activedcId: 'select'}" filter-data="dcsFilterData" ng-bind="getClusterActiveDc(cluster)"></td>
                <td data-title="'集群类型'" filter="{clusterType: 'select'}" filter-data="clusterTypes" ng-bind="getTypeName(cluster.clusterType)"></td>
                <td ng-if="showDetails" data-title="'描述'" ng-bind="cluster.clusterDescription"></td>
                <td ng-if="true" data-title="'组织'" filter="{clusterOrgName: 'select'}" filter-data="organizationNames" ng-bind="cluster.clusterOrgName" ></td>
                <td ng-if="showDetails" data-title="'联系人邮箱'" ng-bind="cluster.clusterAdminEmails"></td>
                <td data-title="'操作'">
                	<a ng-if="showAll" href="/#/cluster_dc?clusterName={{cluster.clusterName}}" class="btn btn-info btn-xs">数据中心</a>&nbsp;
                    <a ng-if="showAll" href="/#/cluster_form?clusterName={{cluster.clusterName}}&type=retrieve" class="btn btn-info btn-xs">Cluster</a>&nbsp;
                    <a ng-if="showAll" href="/#/cluster_shards?clusterName={{cluster.clusterName}}" class="btn btn-info btn-xs">Shards</a>
                    <a href="/#/cluster_routes?clusterName={{cluster.clusterName}}&dcName" class="btn btn-info btn-xs">Routes</a>
                    <a href="/#/migration_event_list?clusterName={{cluster.clusterName}}" class="btn btn-info btn-xs">迁移事件</a>&nbsp;
                    <a ng-if="showAll || showUnhealthy" href="/#/active_dc_migration?clusterName={{cluster.clusterName}}" class="btn btn-danger btn-xs">迁移</a>&nbsp;
                    <a ng-if="showAll" href="/#/cluster_form?clusterName={{cluster.clusterName}}&type=update" class="btn btn-info btn-xs">修改</a>
                    <a ng-if="showAll" class="btn btn-danger btn-xs" ng-click="preDeleteCluster(cluster.clusterName)">删除</a>
                    <a ng-if="showErrorMigrating" class="btn btn-danger btn-xs" ng-click="preResetClusterStatus(cluster.clusterName, cluster.id)">重置状态</a>
                </td>
            </tr>
            <tr ng-repeat-end ng-show="cluster.showDetail">
                <td colspan="6" class="text-left">
                    <ul class="list-unstyled spaced">
                        <li ng-repeat="message in cluster.messages">
                            <i class="ace-icon fa fa-caret-right blue"></i>
                            {{message}}
                        </li>
                    </ul>
                </td>
            </tr>
        </table>
    </div>
</div>

<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
    <i class="icon-double-angle-up icon-only bigger-110"></i>
</a>

<xpipeconfirmdialog xpipe-dialog-id="'deleteClusterConfirm'" xpipe-title="'删除 cluster'"
                    xpipe-detail="'您确定要删除该cluster下的所有内容吗（所有的shards以及相应的redis实例都将被删除）?'"
                    xpipe-show-cancel-btn="true" xpipe-confirm="deleteCluster"></xpipeconfirmdialog>

<xpipeconfirmdialog xpipe-dialog-id="'resetClusterStatusConfirm'" xpipe-title="'重置cluster状态'"
                    xpipe-detail="'您确定要重置迁移状态吗（当前迁移任务可能收到影响）?'"
                    xpipe-show-cancel-btn="true" xpipe-confirm="resetClusterStatus"></xpipeconfirmdialog>

<xpipeconfirmdialog xpipe-dialog-id="'resetSelectedClusterStatusConfirm'" xpipe-title="'重置cluster状态'"
                    xpipe-detail="'您确定要对选中的集群做重置迁移状态的操作吗（当前迁移任务可能收到影响）?'"
                    xpipe-show-cancel-btn="true" xpipe-confirm="resetSelectedClusterStatus"></xpipeconfirmdialog>

<xpipeconfirmdialog xpipe-dialog-id="'continueSelectedClusterConfirm'" xpipe-title="'批量继续'"
                    xpipe-detail="'您确定要对选中的集群做继续迁移的操作吗?'"
                    xpipe-show-cancel-btn="true" xpipe-confirm="continueSelectedCluster"></xpipeconfirmdialog>

<xpipeconfirmdialog xpipe-dialog-id="'forceSelectedClusterConfirm'" xpipe-title="'批量强制继续'"
                    xpipe-detail="'您确定要对选中的集群做强制继续迁移的操作吗?'"
                    xpipe-show-cancel-btn="true" xpipe-confirm="forceSelectedCluster"></xpipeconfirmdialog>
